package classloader;

public class MeClassLoader{

	public static final String ROOT = System.getProperty("user.dir");

	public static void main(String[] args) throws Exception {
//		URL[] urls = new URL[1];
//		URLStreamHandler streamHandler = null;
//		File classPath = new File(ROOT);
//		System.out.println(ROOT);
//		String repository = (new URL("file", null, classPath.getCanonicalPath() + File.separator)).toString();
//		urls[0] = new URL(null, repository, streamHandler);
//
//		Class classClass = new URLClassLoader(urls).loadClass("classloader.MeClassLoader");
//		System.out.println(classClass);
//		((MeClassLoader)classClass.newInstance()).print();
		Class<?> classClass = new NoParentClassLoader().loadClass("classloader.MeClassLoader");
		((MeClassLoader)classClass.newInstance()).print();
		new MeClassLoader().print();
	}
	
	public void print() {
		System.out.println(this.getClass().getClassLoader());
	}
}